<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/5/29
  Time: 11:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>空间设置主页</title>
    <link rel="stylesheet" href="../css/manage.css">
    <script type="text/javascript" src="../js/space-manage-left.js"></script>
</head>

<body>
<!--**************顶部导航****************-->
<%@include file="../jsp/common/nav.jsp"%>
<!--**************左侧导航****************-->
<%@include file="../jsp/common/sidebar-scroll.jsp"%>
<!--***************空间设置主界面*******************-->
<c:set var="user" value="${sessionScope.user}"/>
<c:set var="space" value="${sessionScope.space}"/>
<div class="right">
    <!--标题导航-->
    <div class="manage-nav">
        <span class="manage-nav-title"><a href="index/main?id=${user.id}">学习空间</a></span>
        >
        <span class="manage-nav-title"><a href="index/space-main?userId=${user.id}&name=${space.name}">${space.name}</a></span>
        >
        <span>设置</span>
    </div>
    <div class="manage-detail">
        <div class="manage-menus">
            <div id="manage-menu_title1" class="manage-menu_title" onclick="ManageopenMenu(this)">
                常规设置
                <span>修改空间名、空间描述、空间封面和其他常规设置等</span>
                <div class="manage-indicator" id="manage-indicator1">></div>
            </div>
            <div class="manage-menu" id="manage-menu1">
                <form action="${pageContext.request.contextPath}/space/space-manageForm1" id="form1" method="post" enctype="multipart/form-data">
                    <div class="manage-item" id="manage-item">
                        <input type="hidden" name="id" value="${space.id}">
                        <li><h5>空间名</h5></li>
                        <li><input type="text" size="100" style="height:20px;" name="name" value="${space.name}"/></li>
                    </div>
                    <li class="manage-item_divider"></li>
                    <div class="manage-item">
                        <li><h5>空间描述</h5></li>
                        <li><textarea rows="3" cols="100" name="detail">${space.detail}</textarea></li>
                    </div>
                    <li class="manage-item_divider"></li>
                    <div class="manage-item">
                        <li><h5>空间封面</h5></li>
                        <li>
                            <img src="../images/${space.spaceimage}" class="img1" />
                            <img src="../images/${space.spaceimage}" class="img2" />
                            <input type="hidden" name="id" value="${user.id}">
                            <input type="file" name="file" value='选取图片' onclick="clickBtn()" accept="image/gif, image/jpg, image/png">
                        </li>
                        <input type="submit" onClick="javascript:updateSubmit(document.getElementById('form1').value);" value="保存修改" class="sub"/>
                    </div>
                </form>
            </div>

            <li class="manage-menu_divider"></li>

            <div id="manage-menu_title2" class="manage-menu_title" onclick="ManageopenMenu(this)">
                成员邀请
                <span>为私有的空间提供邀请</span>
                <div class="manage-indicator" id="manage-indicator2">></div>
            </div>
            <div class="manage-menu" id="manage-menu2">
                <div class="manage-item">
                    <li><h5>邀请链接</h5></li>
                    <li><input type="text" id="space_id" size="60" style="height:20px;" value="${space.id}" disabled="disabled"/></li>
                </div>
            </div>

            <li class="manage-menu_divider"></li>

            <div id="manage-menu_title3" class="manage-menu_title" onclick="ManageopenMenu(this)">
                社区关联设置
                <span>处理社区邀请、退出社区</span>
                <div class="manage-indicator" id="manage-indicator3">></div>
            </div>
            <div class="manage-menu" id="manage-menu3">
                <div class="manage-item">
                    <h5>发送社区邀请</h5>
                </div>
                <li class="manage-item_divider"></li>
                <div class="manage-item">
                    <h5>加入的社区</h5>
                </div>
            </div>

            <li class="manage-menu_divider"></li>

            <div id="manage-menu_title4" class="manage-menu_title" onclick="ManageopenMenu(this)">
                高级设置
                <span>修改空间访问级别、设置贡献自动接受</span>
                <div class="manage-indicator" id="manage-indicator4">></div>
            </div>
            <div class="manage-menu" id="manage-menu4">
                <div class="manage-item">
                    <h5>访问权限</h5>
                    <form action="/space/space-manageForm2" id="form2">
                        <input type="hidden" name="id" value="${space.id}">
                        <c:if test="${space.status=='1'}">
                            <div class="radio">
                                <input type="radio" name="status" value="1" id="radio1" checked/>
                                <label for="radio1">公开-允许所有人访问空间</label>
                            </div>
                            <div class="radio">
                                <input type="radio" name="status" value="2" id="radio2"/>
                                <label for="radio2">私有-只允许空间成员访问空间。用户可通过邀请链接加入空间</label>
                            </div>
                        </c:if>
                        <c:if test="${space.status=='2'}">
                            <div class="radio">
                                <input type="radio" name="status" value="1" id="radio3" />
                                <label for="radio1">公开-允许所有人访问空间</label>
                            </div>
                            <div class="radio">
                                <input type="radio" name="status" value="2" id="radio4" checked/>
                                <label for="radio2">私有-只允许空间成员访问空间。用户可通过邀请链接加入空间</label>
                            </div>
                        </c:if>
                        <input type="submit" onClick="javascript:updateSubmit(document.getElementById('form2').value);" value="保存修改" class="sub"/>
                    </form>
                </div>
                <li class="manage-item_divider"></li>
                <div class="manage-item">
                    <h5>自动接受<span style="color:#F66;">(是否需要管理员对用户贡献的资源或修改进行审核)</span></h5>
                    <form action="#" id="form3">
                        <div class="radio"><input type="radio" id="yes" name="autoaccept" checked="checked" /><label for="yes">接受</label></div>
                        <div class="radio"><input type="radio" id="no" name="autoaccept" /><label for="no">不接受</label></div>
                        <input type="button" onClick="javascript:updateSubmit(document.getElementById('form3').value);" value="保存修改" class="sub"/>
                    </form>
                </div>
                <li class="manage-item_divider"></li>
                <div class="manage-item">
                    <form action="/space/space-delete" id="form4">
                        <input type="hidden" name="id" value="${space.id}">
                        <input type="hidden" name="userId" value="${user.id}">
                        <h5>删除空间<span style="color:red;">(删除空间后不可回复，请谨慎操作！)</span></h5>
                        <input type="submit" name="delete" value="删除空间" onClick="del()" class="delBtn"/>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>

